<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Math::Complex - complex numbers and associated mathematical functions - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Math::Complex">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Math::Complex.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Math::Complex">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Math::Complex">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Math::Complex">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Math::Complex">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Math::Complex">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Math::Complex">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Math::Complex">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Math::Complex">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Math::Complex">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Math::Complex">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Math::Complex">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Math::Complex">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Math::Complex">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Math::Complex">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Math::Complex">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Math::Complex">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Math::Complex">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Math::Complex">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Math::Complex">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Math::Complex">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Math::Complex">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Math::Complex">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Math::Complex">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Math::Complex">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Math::Complex">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Math::Complex">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Math::Complex">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Math::Complex">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Math::Complex">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Math::Complex">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Math::Complex">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Math::Complex">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Math::Complex">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Math::Complex">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Math::Complex">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Math::Complex">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Math::Complex">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Math::Complex">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Math::Complex">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Math::Complex">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Math::Complex">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Math::Complex">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Math::Complex">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Math::Complex">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Math::Complex">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Math::Complex">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Math::Complex">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Math::Complex">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Math::Complex">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Math::Complex">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Math::Complex">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Math::Complex">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Math::Complex">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Math::Complex">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Math::Complex">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Math::Complex">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Math::Complex">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Math::Complex">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Math::Complex">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Math::Complex">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Math::Complex">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Math::Complex">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Math::Complex">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Math::Complex">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Math::Complex">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Math::Complex">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Math::Complex">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Math::Complex">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Math::Complex">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Math::Complex">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Math::Complex">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Math::Complex">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Math::Complex">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Math::Complex">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Math::Complex">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Math::Complex">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Math::Complex">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Math::Complex">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Math::Complex">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Math::Complex">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Math::Complex.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Math::Complex">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Math::Complex">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Math::Complex">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Math::Complex">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Math::Complex">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Math::Complex">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Math::Complex">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Math::Complex">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Math::Complex">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Math::Complex">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Math::Complex">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Math::Complex">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Math::Complex">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Math::Complex">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Math::Complex">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Math::Complex">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Math::Complex">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Math::Complex">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Math::Complex">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Math::Complex">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Math::Complex">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Math::Complex">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Math::Complex">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Math::Complex">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Math::Complex">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Math::Complex">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Math::Complex">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Math::Complex">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Math::Complex">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Math::Complex">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Math::Complex">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Math::Complex">5.35.1</a>
          <a class="dropdown-item active" href="./Math::Complex.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Math::Complex.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Math::Complex.html">Math::Complex</a>
          <div id="more">
            (<a href="./Math::Complex.txt">source</a>,
            <a href="https://metacpan.org/pod/Math::Complex">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.5902</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#OPERATIONS">OPERATIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#CREATION">CREATION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#DISPLAYING">DISPLAYING</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#CHANGED-IN-PERL-5.6">CHANGED IN PERL 5.6</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#USAGE">USAGE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#CONSTANTS">CONSTANTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#PI">PI</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#Inf">Inf</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#ERRORS-DUE-TO-DIVISION-BY-ZERO-OR-LOGARITHM-OF-ZERO">ERRORS DUE TO DIVISION BY ZERO OR LOGARITHM OF ZERO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#ERRORS-DUE-TO-INDIGESTIBLE-ARGUMENTS">ERRORS DUE TO INDIGESTIBLE ARGUMENTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#BUGS">BUGS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Math::Complex.html#LICENSE">LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Math::Complex.html#NAME">#</a>NAME</h1>

<p>Math::Complex - complex numbers and associated mathematical functions</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Math::Complex.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Math::Complex;

$z = Math::Complex-&gt;make(5, 6);
$t = 4 - 3*i + $z;
$j = cplxe(1, 2*pi/3);</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Math::Complex.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This package lets you create and manipulate complex numbers. By default, <i>Perl</i> limits itself to real numbers, but an extra <code>use</code> statement brings full complex support, along with a full set of mathematical functions typically associated with and/or extended to complex numbers.</p>

<p>If you wonder what complex numbers are, they were invented to be able to solve the following equation:</p>

<pre><code class="plaintext">x*x = -1</code></pre>

<p>and by definition, the solution is noted <i>i</i> (engineers use <i>j</i> instead since <i>i</i> usually denotes an intensity, but the name does not matter). The number <i>i</i> is a pure <i>imaginary</i> number.</p>

<p>The arithmetics with pure imaginary numbers works just like you would expect it with real numbers... you just have to remember that</p>

<pre><code class="plaintext">i*i = -1</code></pre>

<p>so you have:</p>

<pre><code class="plaintext">5i + 7i = i * (5 + 7) = 12i
4i - 3i = i * (4 - 3) = i
4i * 2i = -8
6i / 2i = 3
1 / i = -i</code></pre>

<p>Complex numbers are numbers that have both a real part and an imaginary part, and are usually noted:</p>

<pre><code class="plaintext">a + bi</code></pre>

<p>where <code>a</code> is the <i>real</i> part and <code>b</code> is the <i>imaginary</i> part. The arithmetic with complex numbers is straightforward. You have to keep track of the real and the imaginary parts, but otherwise the rules used for real numbers just apply:</p>

<pre><code class="plaintext">(4 + 3i) + (5 - 2i) = (4 + 5) + i(3 - 2) = 9 + i
(2 + i) * (4 - i) = 2*4 + 4i -2i -i*i = 8 + 2i + 1 = 9 + 2i</code></pre>

<p>A graphical representation of complex numbers is possible in a plane (also called the <i>complex plane</i>, but it&#39;s really a 2D plane). The number</p>

<pre><code class="plaintext">z = a + bi</code></pre>

<p>is the point whose coordinates are (a, b). Actually, it would be the vector originating from (0, 0) to (a, b). It follows that the addition of two complex numbers is a vectorial addition.</p>

<p>Since there is a bijection between a point in the 2D plane and a complex number (i.e. the mapping is unique and reciprocal), a complex number can also be uniquely identified with polar coordinates:</p>

<pre><code class="plaintext">[rho, theta]</code></pre>

<p>where <code>rho</code> is the distance to the origin, and <code>theta</code> the angle between the vector and the <i>x</i> axis. There is a notation for this using the exponential form, which is:</p>

<pre><code class="plaintext">rho * exp(i * theta)</code></pre>

<p>where <i>i</i> is the famous imaginary number introduced above. Conversion between this form and the cartesian form <code>a + bi</code> is immediate:</p>

<pre><code class="plaintext">a = rho * cos(theta)
b = rho * sin(theta)</code></pre>

<p>which is also expressed by this formula:</p>

<pre><code class="plaintext">z = rho * exp(i * theta) = rho * (cos theta + i * sin theta)</code></pre>

<p>In other words, it&#39;s the projection of the vector onto the <i>x</i> and <i>y</i> axes. Mathematicians call <i>rho</i> the <i>norm</i> or <i>modulus</i> and <i>theta</i> the <i>argument</i> of the complex number. The <i>norm</i> of <code>z</code> is marked here as <code>abs(z)</code>.</p>

<p>The polar notation (also known as the trigonometric representation) is much more handy for performing multiplications and divisions of complex numbers, whilst the cartesian notation is better suited for additions and subtractions. Real numbers are on the <i>x</i> axis, and therefore <i>y</i> or <i>theta</i> is zero or <i>pi</i>.</p>

<p>All the common operations that can be performed on a real number have been defined to work on complex numbers as well, and are merely <i>extensions</i> of the operations defined on real numbers. This means they keep their natural meaning when there is no imaginary part, provided the number is within their definition set.</p>

<p>For instance, the <code>sqrt</code> routine which computes the square root of its argument is only defined for non-negative real numbers and yields a non-negative real number (it is an application from <b>R+</b> to <b>R+</b>). If we allow it to return a complex number, then it can be extended to negative real numbers to become an application from <b>R</b> to <b>C</b> (the set of complex numbers):</p>

<pre><code class="plaintext">sqrt(x) = x &gt;= 0 ? sqrt(x) : sqrt(-x)*i</code></pre>

<p>It can also be extended to be an application from <b>C</b> to <b>C</b>, whilst its restriction to <b>R</b> behaves as defined above by using the following definition:</p>

<pre><code class="plaintext">sqrt(z = [r,t]) = sqrt(r) * exp(i * t/2)</code></pre>

<p>Indeed, a negative real number can be noted <code>[x,pi]</code> (the modulus <i>x</i> is always non-negative, so <code>[x,pi]</code> is really <code>-x</code>, a negative number) and the above definition states that</p>

<pre><code class="plaintext">sqrt([x,pi]) = sqrt(x) * exp(i*pi/2) = [sqrt(x),pi/2] = sqrt(x)*i</code></pre>

<p>which is exactly what we had defined for negative real numbers above. The <code>sqrt</code> returns only one of the solutions: if you want the both, use the <code>root</code> function.</p>

<p>All the common mathematical functions defined on real numbers that are extended to complex numbers share that same property of working <i>as usual</i> when the imaginary part is zero (otherwise, it would not be called an extension, would it?).</p>

<p>A <i>new</i> operation possible on a complex number that is the identity for real numbers is called the <i>conjugate</i>, and is noted with a horizontal bar above the number, or <code>~z</code> here.</p>

<pre><code class="plaintext"> z = a + bi
~z = a - bi</code></pre>

<p>Simple... Now look:</p>

<pre><code class="plaintext">z * ~z = (a + bi) * (a - bi) = a*a + b*b</code></pre>

<p>We saw that the norm of <code>z</code> was noted <code>abs(z)</code> and was defined as the distance to the origin, also known as:</p>

<pre><code class="plaintext">rho = abs(z) = sqrt(a*a + b*b)</code></pre>

<p>so</p>

<pre><code class="plaintext">z * ~z = abs(z) ** 2</code></pre>

<p>If z is a pure real number (i.e. <code>b == 0</code>), then the above yields:</p>

<pre><code class="plaintext">a * a = abs(a) ** 2</code></pre>

<p>which is true (<code>abs</code> has the regular meaning for real number, i.e. stands for the absolute value). This example explains why the norm of <code>z</code> is noted <code>abs(z)</code>: it extends the <code>abs</code> function to complex numbers, yet is the regular <code>abs</code> we know when the complex number actually has no imaginary part... This justifies <i>a posteriori</i> our use of the <code>abs</code> notation for the norm.</p>

<h1 id="OPERATIONS"><a class="permalink" href="./Math::Complex.html#OPERATIONS">#</a>OPERATIONS</h1>

<p>Given the following notations:</p>

<pre><code class="plaintext">z1 = a + bi = r1 * exp(i * t1)
z2 = c + di = r2 * exp(i * t2)
z = &lt;any complex or real number&gt;</code></pre>

<p>the following (overloaded) operations are supported on complex numbers:</p>

<pre><code class="plaintext">z1 + z2 = (a + c) + i(b + d)
z1 - z2 = (a - c) + i(b - d)
z1 * z2 = (r1 * r2) * exp(i * (t1 + t2))
z1 / z2 = (r1 / r2) * exp(i * (t1 - t2))
z1 ** z2 = exp(z2 * log z1)
~z = a - bi
abs(z) = r1 = sqrt(a*a + b*b)
sqrt(z) = sqrt(r1) * exp(i * t/2)
exp(z) = exp(a) * exp(i * b)
log(z) = log(r1) + i*t
sin(z) = 1/2i (exp(i * z1) - exp(-i * z))
cos(z) = 1/2 (exp(i * z1) + exp(-i * z))
atan2(y, x) = atan(y / x) # Minding the right quadrant, note the order.</code></pre>

<p>The definition used for complex arguments of atan2() is</p>

<pre><code class="plaintext">-i log((x + iy)/sqrt(x*x+y*y))</code></pre>

<p>Note that atan2(0, 0) is not well-defined.</p>

<p>The following extra operations are supported on both real and complex numbers:</p>

<pre><code class="plaintext">Re(z) = a
Im(z) = b
arg(z) = t
abs(z) = r

cbrt(z) = z ** (1/3)
log10(z) = log(z) / log(10)
logn(z, n) = log(z) / log(n)

tan(z) = sin(z) / cos(z)

csc(z) = 1 / sin(z)
sec(z) = 1 / cos(z)
cot(z) = 1 / tan(z)

asin(z) = -i * log(i*z + sqrt(1-z*z))
acos(z) = -i * log(z + i*sqrt(1-z*z))
atan(z) = i/2 * log((i+z) / (i-z))

acsc(z) = asin(1 / z)
asec(z) = acos(1 / z)
acot(z) = atan(1 / z) = -i/2 * log((i+z) / (z-i))

sinh(z) = 1/2 (exp(z) - exp(-z))
cosh(z) = 1/2 (exp(z) + exp(-z))
tanh(z) = sinh(z) / cosh(z) = (exp(z) - exp(-z)) / (exp(z) + exp(-z))

csch(z) = 1 / sinh(z)
sech(z) = 1 / cosh(z)
coth(z) = 1 / tanh(z)

asinh(z) = log(z + sqrt(z*z+1))
acosh(z) = log(z + sqrt(z*z-1))
atanh(z) = 1/2 * log((1+z) / (1-z))

acsch(z) = asinh(1 / z)
asech(z) = acosh(1 / z)
acoth(z) = atanh(1 / z) = 1/2 * log((1+z) / (z-1))</code></pre>

<p><i>arg</i>, <i>abs</i>, <i>log</i>, <i>csc</i>, <i>cot</i>, <i>acsc</i>, <i>acot</i>, <i>csch</i>, <i>coth</i>, <i>acosech</i>, <i>acotanh</i>, have aliases <i>rho</i>, <i>theta</i>, <i>ln</i>, <i>cosec</i>, <i>cotan</i>, <i>acosec</i>, <i>acotan</i>, <i>cosech</i>, <i>cotanh</i>, <i>acosech</i>, <i>acotanh</i>, respectively. <code>Re</code>, <code>Im</code>, <code>arg</code>, <code>abs</code>, <code>rho</code>, and <code>theta</code> can be used also as mutators. The <code>cbrt</code> returns only one of the solutions: if you want all three, use the <code>root</code> function.</p>

<p>The <i>root</i> function is available to compute all the <i>n</i> roots of some complex, where <i>n</i> is a strictly positive integer. There are exactly <i>n</i> such roots, returned as a list. Getting the number mathematicians call <code>j</code> such that:</p>

<pre><code>1 + j + j*j = 0;</code></pre>

<p>is a simple matter of writing:</p>

<pre><code>$j = ((root(1, 3))[1];</code></pre>

<p>The <i>k</i>th root for <code>z = [r,t]</code> is given by:</p>

<pre><code class="plaintext">(root(z, n))[k] = r**(1/n) * exp(i * (t + 2*k*pi)/n)</code></pre>

<p>You can return the <i>k</i>th root directly by <code>root(z, n, k)</code>, indexing starting from <i>zero</i> and ending at <i>n - 1</i>.</p>

<p>The <i>spaceship</i> numeric comparison operator, &lt;=&gt;, is also defined. In order to ensure its restriction to real numbers is conform to what you would expect, the comparison is run on the real part of the complex number first, and imaginary parts are compared only when the real parts match.</p>

<h1 id="CREATION"><a class="permalink" href="./Math::Complex.html#CREATION">#</a>CREATION</h1>

<p>To create a complex number, use either:</p>

<pre><code>$z = Math::Complex-&gt;make(3, 4);
$z = cplx(3, 4);</code></pre>

<p>if you know the cartesian form of the number, or</p>

<pre><code>$z = 3 + 4*i;</code></pre>

<p>if you like. To create a number using the polar form, use either:</p>

<pre><code>$z = Math::Complex-&gt;emake(5, pi/3);
$x = cplxe(5, pi/3);</code></pre>

<p>instead. The first argument is the modulus, the second is the angle (in radians, the full circle is 2*pi). (Mnemonic: <code>e</code> is used as a notation for complex numbers in the polar form).</p>

<p>It is possible to write:</p>

<pre><code>$x = cplxe(-3, pi/4);</code></pre>

<p>but that will be silently converted into <code>[3,-3pi/4]</code>, since the modulus must be non-negative (it represents the distance to the origin in the complex plane).</p>

<p>It is also possible to have a complex number as either argument of the <code>make</code>, <code>emake</code>, <code>cplx</code>, and <code>cplxe</code>: the appropriate component of the argument will be used.</p>

<pre><code>$z1 = cplx(-2,  1);
$z2 = cplx($z1, 4);</code></pre>

<p>The <code>new</code>, <code>make</code>, <code>emake</code>, <code>cplx</code>, and <code>cplxe</code> will also understand a single (string) argument of the forms</p>

<pre><code class="plaintext">    	2-3i
    	-3i
	[2,3]
	[2,-3pi/4]
	[2]</code></pre>

<p>in which case the appropriate cartesian and exponential components will be parsed from the string and used to create new complex numbers. The imaginary component and the theta, respectively, will default to zero.</p>

<p>The <code>new</code>, <code>make</code>, <code>emake</code>, <code>cplx</code>, and <code>cplxe</code> will also understand the case of no arguments: this means plain zero or (0, 0).</p>

<h1 id="DISPLAYING"><a class="permalink" href="./Math::Complex.html#DISPLAYING">#</a>DISPLAYING</h1>

<p>When printed, a complex number is usually shown under its cartesian style <i>a+bi</i>, but there are legitimate cases where the polar style <i>[r,t]</i> is more appropriate. The process of converting the complex number into a string that can be displayed is known as <i>stringification</i>.</p>

<p>By calling the class method <code>Math::Complex::display_format</code> and supplying either <code>&quot;polar&quot;</code> or <code>&quot;cartesian&quot;</code> as an argument, you override the default display style, which is <code>&quot;cartesian&quot;</code>. Not supplying any argument returns the current settings.</p>

<p>This default can be overridden on a per-number basis by calling the <code>display_format</code> method instead. As before, not supplying any argument returns the current display style for this number. Otherwise whatever you specify will be the new display style for <i>this</i> particular number.</p>

<p>For instance:</p>

<pre><code>use Math::Complex;

Math::Complex::display_format(&#39;polar&#39;);
$j = (root(1, 3))[1];
print &quot;j = $j\n&quot;;		# Prints &quot;j = [1,2pi/3]&quot;
$j-&gt;display_format(&#39;cartesian&#39;);
print &quot;j = $j\n&quot;;		# Prints &quot;j = -0.5+0.866025403784439i&quot;</code></pre>

<p>The polar style attempts to emphasize arguments like <i>k*pi/n</i> (where <i>n</i> is a positive integer and <i>k</i> an integer within [-9, +9]), this is called <i>polar pretty-printing</i>.</p>

<p>For the reverse of stringifying, see the <code>make</code> and <code>emake</code>.</p>

<h2 id="CHANGED-IN-PERL-5.6"><a class="permalink" href="./Math::Complex.html#CHANGED-IN-PERL-5.6">#</a><a id="CHANGED"></a>CHANGED IN PERL 5.6</h2>

<p>The <code>display_format</code> class method and the corresponding <code>display_format</code> object method can now be called using a parameter hash instead of just a one parameter.</p>

<p>The old display format style, which can have values <code>&quot;cartesian&quot;</code> or <code>&quot;polar&quot;</code>, can be changed using the <code>&quot;style&quot;</code> parameter.</p>

<pre><code>$j-&gt;display_format(style =&gt; &quot;polar&quot;);</code></pre>

<p>The one parameter calling convention also still works.</p>

<pre><code>$j-&gt;display_format(&quot;polar&quot;);</code></pre>

<p>There are two new display parameters.</p>

<p>The first one is <code>&quot;format&quot;</code>, which is a sprintf()-style format string to be used for both numeric parts of the complex number(s). The is somewhat system-dependent but most often it corresponds to <code>&quot;%.15g&quot;</code>. You can revert to the default by setting the <code>format</code> to <code>undef</code>.</p>

<pre><code># the $j from the above example

$j-&gt;display_format(&#39;format&#39; =&gt; &#39;%.5f&#39;);
print &quot;j = $j\n&quot;;		# Prints &quot;j = -0.50000+0.86603i&quot;
$j-&gt;display_format(&#39;format&#39; =&gt; undef);
print &quot;j = $j\n&quot;;		# Prints &quot;j = -0.5+0.86603i&quot;</code></pre>

<p>Notice that this affects also the return values of the <code>display_format</code> methods: in list context the whole parameter hash will be returned, as opposed to only the style parameter value. This is a potential incompatibility with earlier versions if you have been calling the <code>display_format</code> method in list context.</p>

<p>The second new display parameter is <code>&quot;polar_pretty_print&quot;</code>, which can be set to true or false, the default being true. See the previous section for what this means.</p>

<h1 id="USAGE"><a class="permalink" href="./Math::Complex.html#USAGE">#</a>USAGE</h1>

<p>Thanks to overloading, the handling of arithmetics with complex numbers is simple and almost transparent.</p>

<p>Here are some examples:</p>

<pre><code>use Math::Complex;

$j = cplxe(1, 2*pi/3);	# $j ** 3 == 1
print &quot;j = $j, j**3 = &quot;, $j ** 3, &quot;\n&quot;;
print &quot;1 + j + j**2 = &quot;, 1 + $j + $j**2, &quot;\n&quot;;

$z = -16 + 0*i;			# Force it to be a complex
print &quot;sqrt($z) = &quot;, sqrt($z), &quot;\n&quot;;

$k = exp(i * 2*pi/3);
print &quot;$j - $k = &quot;, $j - $k, &quot;\n&quot;;

$z-&gt;Re(3);			# Re, Im, arg, abs,
$j-&gt;arg(2);			# (the last two aka rho, theta)
				# can be used also as mutators.</code></pre>

<h1 id="CONSTANTS"><a class="permalink" href="./Math::Complex.html#CONSTANTS">#</a>CONSTANTS</h1>

<h2 id="PI"><a class="permalink" href="./Math::Complex.html#PI">#</a>PI</h2>

<p>The constant <code>pi</code> and some handy multiples of it (pi2, pi4, and pip2 (pi/2) and pip4 (pi/4)) are also available if separately exported:</p>

<pre><code>use Math::Complex &#39;:pi&#39;; 
$third_of_circle = pi2 / 3;</code></pre>

<h2 id="Inf"><a class="permalink" href="./Math::Complex.html#Inf">#</a>Inf</h2>

<p>The floating point infinity can be exported as a subroutine Inf():</p>

<pre><code>use Math::Complex qw(Inf sinh);
my $AlsoInf = Inf() + 42;
my $AnotherInf = sinh(1e42);
print &quot;$AlsoInf is $AnotherInf\n&quot; if $AlsoInf == $AnotherInf;</code></pre>

<p>Note that the stringified form of infinity varies between platforms: it can be for example any of</p>

<pre><code class="plaintext">inf
infinity
INF
1.#INF</code></pre>

<p>or it can be something else.</p>

<p>Also note that in some platforms trying to use the infinity in arithmetic operations may result in Perl crashing because using an infinity causes SIGFPE or its moral equivalent to be sent. The way to ignore this is</p>

<pre><code>local $SIG{FPE} = sub { };</code></pre>

<h1 id="ERRORS-DUE-TO-DIVISION-BY-ZERO-OR-LOGARITHM-OF-ZERO"><a class="permalink" href="./Math::Complex.html#ERRORS-DUE-TO-DIVISION-BY-ZERO-OR-LOGARITHM-OF-ZERO">#</a><a id="ERRORS"></a>ERRORS DUE TO DIVISION BY ZERO OR LOGARITHM OF ZERO</h1>

<p>The division (/) and the following functions</p>

<pre><code class="plaintext">log	ln	log10	logn
tan	sec	csc	cot
atan	asec	acsc	acot
tanh	sech	csch	coth
atanh	asech	acsch	acoth</code></pre>

<p>cannot be computed for all arguments because that would mean dividing by zero or taking logarithm of zero. These situations cause fatal runtime errors looking like this</p>

<pre><code class="plaintext">cot(0): Division by zero.
(Because in the definition of cot(0), the divisor sin(0) is 0)
Died at ...</code></pre>

<p>or</p>

<pre><code class="plaintext">atanh(-1): Logarithm of zero.
Died at...</code></pre>

<p>For the <code>csc</code>, <code>cot</code>, <code>asec</code>, <code>acsc</code>, <code>acot</code>, <code>csch</code>, <code>coth</code>, <code>asech</code>, <code>acsch</code>, the argument cannot be <code>0</code> (zero). For the logarithmic functions and the <code>atanh</code>, <code>acoth</code>, the argument cannot be <code>1</code> (one). For the <code>atanh</code>, <code>acoth</code>, the argument cannot be <code>-1</code> (minus one). For the <code>atan</code>, <code>acot</code>, the argument cannot be <code>i</code> (the imaginary unit). For the <code>atan</code>, <code>acoth</code>, the argument cannot be <code>-i</code> (the negative imaginary unit). For the <code>tan</code>, <code>sec</code>, <code>tanh</code>, the argument cannot be <i>pi/2 + k * pi</i>, where <i>k</i> is any integer. atan2(0, 0) is undefined, and if the complex arguments are used for atan2(), a division by zero will happen if z1**2+z2**2 == 0.</p>

<p>Note that because we are operating on approximations of real numbers, these errors can happen when merely `too close&#39; to the singularities listed above.</p>

<h1 id="ERRORS-DUE-TO-INDIGESTIBLE-ARGUMENTS"><a class="permalink" href="./Math::Complex.html#ERRORS-DUE-TO-INDIGESTIBLE-ARGUMENTS">#</a><a id="ERRORS1"></a>ERRORS DUE TO INDIGESTIBLE ARGUMENTS</h1>

<p>The <code>make</code> and <code>emake</code> accept both real and complex arguments. When they cannot recognize the arguments they will die with error messages like the following</p>

<pre><code class="plaintext">Math::Complex::make: Cannot take real part of ...
Math::Complex::make: Cannot take real part of ...
Math::Complex::emake: Cannot take rho of ...
Math::Complex::emake: Cannot take theta of ...</code></pre>

<h1 id="BUGS"><a class="permalink" href="./Math::Complex.html#BUGS">#</a>BUGS</h1>

<p>Saying <code>use Math::Complex;</code> exports many mathematical routines in the caller environment and even overrides some (<code>sqrt</code>, <code>log</code>, <code>atan2</code>). This is construed as a feature by the Authors, actually... ;-)</p>

<p>All routines expect to be given real or complex numbers. Don&#39;t attempt to use BigFloat, since Perl has currently no rule to disambiguate a &#39;+&#39; operation (for instance) between two overloaded entities.</p>

<p>In Cray UNICOS there is some strange numerical instability that results in root(), cos(), sin(), cosh(), sinh(), losing accuracy fast. Beware. The bug may be in UNICOS math libs, in UNICOS C compiler, in Math::Complex. Whatever it is, it does not manifest itself anywhere else where Perl runs.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Math::Complex.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="./Math::Trig.html">Math::Trig</a></p>

<h1 id="AUTHORS"><a class="permalink" href="./Math::Complex.html#AUTHORS">#</a>AUTHORS</h1>

<p>Daniel S. Lewart &lt;<i>lewart!at!uiuc.edu</i>&gt;, Jarkko Hietaniemi &lt;<i>jhi!at!iki.fi</i>&gt;, Raphael Manfredi &lt;<i>Raphael_Manfredi!at!pobox.com</i>&gt;, Zefram &lt;zefram@fysh.org&gt;</p>

<h1 id="LICENSE"><a class="permalink" href="./Math::Complex.html#LICENSE">#</a>LICENSE</h1>

<p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
